<!DOCTYPE html>
<html>
<!-- 洗车结束 -->

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title style="background-color: #00c6a7;">上传照片</title>
	<link rel="stylesheet" type="text/css" href="../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="../css/ali-icon/iconfont.css" />
	<style type="text/css">
		.order {
			height: 60px;
			line-height: 60px;
			text-align: center;
		}

		.order .line {
			display: inline-block;
			width: 150px;
			border-top: 1px solid #ccc;
		}

		.order .txt {
			color: #686868;
			vertical-align: middle;
		}
	</style>
</head>

<body>
	<div id="app">
		<header class="aui-bar aui-bar-nav" style="padding-top:25px;background-color: #00c6a7;">
			<a class="aui-pull-left aui-btn" onclick="api.closeWin();">
				<span class="aui-iconfont aui-icon-left"></span>
			</a>
			<div class="aui-title" style="background-color: #00c6a7;">上传照片</div>
		</header>
		<div class="order">
			<span class="line"></span>
			<span class="txt">正面</span>
			<span class="line"></span>
		</div>
		<ul class="aui-list aui-media-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-row aui-row-padded">
						<div class="aui-col-xs-6">
							<img src="../image/front.jpg" height="100px;" width="100px;" />
						</div>
						<div class="aui-col-xs-6" @click="showAction('afront');">
							<img id="afront" name="afront" src="../image/after.png" height="100px;" width="100px;" />
						</div>
					</div>
				</div>
			</li>
		</ul>
		<div class="order">
			<span class="line"></span>
			<span class="txt">侧面</span>
			<span class="line"></span>
		</div>
		<ul class="aui-list aui-media-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-row aui-row-padded">
						<div class="aui-col-xs-6">
							<img src="../image/left.jpg" height="100px;" width="100px;" />
						</div>
						<div class="aui-col-xs-6" @click="showAction('aleft');">
							<img id="aleft" name="aleft" src="../image/after.png" height="100px;" width="100px;" />
						</div>
					</div>
				</div>
			</li>
		</ul>
		<div class="order">
			<span class="line"></span>
			<span class="txt">侧面</span>
			<span class="line"></span>
		</div>
		<ul class="aui-list aui-media-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-row aui-row-padded">
						<div class="aui-col-xs-6">
							<img src="../image/left.jpg" height="100px;" width="100px;" />
						</div>
						<div class="aui-col-xs-6" @click="showAction('aright');">
							<img id="aright" name="aright" src="../image/after.png" height="100px;" width="100px;" />
						</div>
					</div>
				</div>
			</li>
		</ul>
		<div class="order">
			<span class="line"></span>
			<span class="txt">背面</span>
			<span class="line"></span>
		</div>
		<ul class="aui-list aui-media-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-row aui-row-padded">
						<div class="aui-col-xs-6">
							<img src="../image/back.jpg" height="100px;" width="100px;" />
						</div>
						<div class="aui-col-xs-6" @click="showAction('aback');">
							<img id="aback" name="aback" src="../image/after.png" height="100px;" width="100px;" />
						</div>
					</div>
				</div>
			</li>
		</ul>
		<ul class="aui-list aui-form-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label">
						车型
					</div>
					<div class="aui-list-item-input">
						<select v-model="carType">
              <option v-for="(type,index) in typeList" :key="index" :value="type.dict_id + ':' + type.dict_value" >{{type.dict_value}}</option>
            </select>
					</div>
				</div>
			</li>
		</ul>
		<div class="aui-card-list-footer aui-border-t">
			<section class="aui-grid aui-margin-b-15">
				<div class="aui-row">
					<div class="aui-bar-btn-item" style="background-color: #00c6a7;border-color:#ffffff;color:#ffffff;" onclick="openDialog('text')">跳过此步骤</div>
					<div class="aui-bar-btn-item" style="background-color: #00c6a7;border-color:#ffffff;color:#ffffff;" onclick="startorder()">结束洗车</div>
				</div>
			</section>
		</div>
	</div>

</body>
<script type="text/javascript" src="../script/common/vue.js"></script>
<script type="text/javascript" src="../script/base64.js"></script>
<script type="text/javascript" src="../script/md5.js"></script>
<script type="text/javascript" src="../script/common/api.js"></script>
<script type="text/javascript" src="../script/my/photo.js"></script>
<script type="text/javascript" src="../script/aui-dialog.js"></script>
<script type="text/javascript">
	apiready = function() {
		vm.getCarType();
		// vm.getCar();
	};
	var dialog = new auiDialog();

	function openDialog(type) {
		switch (type) {
			case "text":
				dialog.alert({
					title: "提醒",
					msg: '因特殊情况跳过“上传照片步骤”，请在洗车结束后及时补传照片，否则该订单无法进行结算。',
					buttons: ['确定']
				}, function(ret) {
					if (ret) {
						if (ret.buttonIndex == 1) {
							vm.saveCar(function() {
								var curorder = api.getGlobalData({
									key: 'curOrder'
								});
								curorder.technician = api.getGlobalData({
									key: 'technicianid'
								});
								curorder.status = vm.orderStatus.TRADE_SUCCESS;
								vm.updateOrder(curorder, function(ret, err) {
									if (ret) {
										// 关闭订单坐标上传开关
										api.setGlobalData({
											key: 'isorder',
											value: false
										});
										//发送订单完成事件
										api.sendEvent({
											name: 'orderaccept',
											extra: {
												msg: '订单完成'
											}
										});
										api.closeToWin({
											name: 'root'
										});
									}
								});
							})
						}
					}
				})
				break;
			case "callback":
				dialog.alert({
					title: "弹出提示",
					msg: '这里是内容',
					buttons: ['取消', '确定']
				}, function(ret) {
					if (ret) {
						dialog.alert({
							title: "提示",
							msg: "您点击了第" + ret.buttonIndex + "个按钮",
							buttons: ['确定']
						});
					}
				})
				break;
			default:
				break;

		}
	}

	function startorder() {
		vm.saveCar(function() {
			if (!vm.hasNullFile()) {
				vm.bindPhoto(vm.orderStatus.TRADE_SUCCESS, vm.imglist, function(ret, err) {
					var curorder = api.getGlobalData({
						key: 'curOrder'
					});
					curorder.technician = api.getGlobalData({
						key: 'technicianid'
					});
					curorder.status = vm.orderStatus.TRADE_SUCCESS;
					vm.updateOrder(curorder, function(ret, err) {
						if (ret) {
							//关闭订单坐标上传开关
							api.setGlobalData({
								key: 'isorder',
								value: false
							});
							//发送订单完成事件
							api.sendEvent({
								name: 'orderaccept',
								extra: {
									msg: '订单完成'
								}
							});
							api.closeToWin({
								name: 'root'
							});
						}
						console.log('errupdate: ' + err);
					});
				});
			}
		});
	};
</script>

</html>
